From: Aaron Schulz Date: Wed, 10 Sep 2008 21:30:11 +0000 (+0000) Subject: Exclude bot edits from Special:Contributions/newbies (bug 15554) X-Git-Tag: 1.31.0-rc.0~45373 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=a33a33b30eca828a9ed01f95acc2561570aaa772;p=lhc%2Fweb%2Fwiklou.git Exclude bot edits from Special:Contributions/newbies (bug 15554) --- diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 74c5f3ad4d..694690dc2a 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -34,17 +34,18 @@ class ContribsPager extends ReverseChronologicalPager { } function getQueryInfo() { - list( $index, $userCond ) = $this->getUserCond(); + list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond(); $conds = array_merge( array('page_id=rev_page'), $userCond, $this->getNamespaceCond() ); $queryInfo = array( - 'tables' => array( 'page', 'revision' ), + 'tables' => $tables, 'fields' => array( 'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment', 'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted' ), 'conds' => $conds, - 'options' => array( 'USE INDEX' => array('revision' => $index) ) + 'options' => array( 'USE INDEX' => array('revision' => $index) ), + 'join_conds' => $join_cond ); wfRunHooks( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) ); return $queryInfo; @@ -52,16 +53,21 @@ class ContribsPager extends ReverseChronologicalPager { function getUserCond() { $condition = array(); - + $join_conds = array(); if ( $this->target == 'newbies' ) { + $tables = array( 'user_groups', 'page', 'revision' ); $max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ ); $condition[] = 'rev_user >' . (int)($max - $max / 100); + $condition[] = 'ug_group IS NULL'; $index = 'user_timestamp'; + # FIXME: other groups may have 'bot' rights + $join_conds['user_groups'] = array( 'LEFT JOIN', "ug_user = rev_user AND ug_group = 'bot'" ); } else { + $tables = array( 'page', 'revision' ); $condition['rev_user_text'] = $this->target; $index = 'usertext_timestamp'; } - return array( $index, $condition ); + return array( $tables, $index, $condition, $join_conds ); } function getNamespaceCond() {